package ui;

import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import colors.Color;

public class TargetGridCellRenderer extends DefaultTableCellRenderer
{	  
	/**
	 * 
	 */
	private static final long serialVersionUID = -4427083365885982825L;

	public Component getTableCellRendererComponent (JTable table, 
		Object obj, boolean isSelected, boolean hasFocus, int row, int column) {

		Component cell = super.getTableCellRendererComponent(table, obj, isSelected, hasFocus, row, column);
	
		if(table.getClass() == TargetGridTable.class)
		{
			Color color = (Color) table.getValueAt(row, column);
			cell.setName("");
			cell.setBackground(new java.awt.Color(color.R, color.G, color.B));
		}
		return cell;
	}
}
